/*
 * @Author: your name
 * @Date: 2021-11-13 15:40:01
 * @LastEditTime: 2021-11-29 11:01:05
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \li-yuwei\serve\app\controller\tagDb.js
 */
const Controller = require("../core/base_controller");
class ClassifyController extends Controller {
    //获取分类
    async getClassifyList() {
            const { ctx } = this;
            try {
                const res = await ctx.service.classify.getClassifyList();
                this.success(res);
            } catch (err) {
                this.error(err.message);
            }
        }
        //获取分类个数
    async getClassifyTotal() {
            const { ctx } = this;
            try {
                const res = await ctx.service.classify.getClassifyTotal();
                this.success(res);
            } catch (err) {
                this.error(err.message);
            }
        }
        //添加分类
    async addClassifyList() {
            const { ctx } = this;
            try {
                const res = await ctx.service.classify.addClassifyList();
                this.success(res);
            } catch (err) {
                this.error(err.message);
            }
        }
        //删除分类
    async delClassifyList() {
            const { ctx } = this;
            try {
                const res = await ctx.service.classify.delClassifyList();
                this.success(res);
            } catch (err) {
                this.error(err.message);
            }
        }
        //更新
    async editClassifyList() {
        const { ctx } = this;
        try {
            const res = await ctx.service.classify.editClassifyList();
            this.success(res);
        } catch (err) {
            this.error(err.message);
        }
    }

    // **********用户端*************//
    //文章分类数据
    async getClassifyArticle() {
            const { ctx } = this;
            try {
                const res = await ctx.service.classify.getClassifyArticle();
                this.success(res);
            } catch (err) {
                this.error(err.message);
            }
        }
        //获取分类个数
    async getClassifyNum() {
        const { ctx } = this;
        try {
            const res = await ctx.service.classify.getClassifyNum();
            this.success(res);
        } catch (err) {
            this.error(err.message);
        }
    }
}

module.exports = ClassifyController;